<div class="modal" ng-controller="FlowableProcessReferencePopupCtrl">
  <div class="modal-dialog modal-wide">
    <div class="modal-content">
      <div class="modal-header">
        <button aria-hidden="true" class="close" data-dismiss="modal" ng-click="close()" type="button">&times;</button>
        <h2>
          {{'PROPERTY.PROCESSREFERENCE.TITLE' | translate}}
          <span ng-show="selectedProcess != null"> - {{selectedProcess.name}}</span>
          <span ng-show="selectedProcess == null"> - {{'PROPERTY.PROCESSREFERENCE.EMPTY' | translate}}</span>

        </h2>
      </div>
      <div class="modal-body-with-overflow">
        <div class="detail-group clearfix">
          <div class="col-xs-12">
            <div class="alert alert-error"
                 ng-show="(!state.loadingFolders && !state.loadingProcesses) && state.processError" translate>
              PROPERTY.PROCESSREFERENCE.ERROR.PROCESS
            </div>
          </div>
        </div>
        <div class="detail-group clearfix">
          <div class="col-xs-12 editor-item-picker">
            <div class="col-xs-4 editor-item-picker-component"
                 ng-class="{'selected' : processModel.id == selectedProcess.id}"
                 ng-click="selectProcess(processModel, $event)"
                 ng-if="!state.loadingProcesses && !state.processError"
                 ng-repeat="processModel in processModels">
              <div class="controls">
                <input ng-checked="processModel.id == selectedProcess.id" ng-click="selectProcess(processModel, $event)"
                       type="checkbox"
                       value="option1"/>
              </div>
              <h4>{{processModel.name}}</h4>
              <img src="{{getModelThumbnailUrl(processModel.id)}}"/>
            </div>
            <div ng-show="state.loadingProcesses">
              <p class="loading" translate>PROPERTY.PROCESSREFERENCE.PROCESS.LOADING</p>
            </div>
            <div ng-show="!state.loadingProcesses && processModels.length == 0">
              <p translate>PROPERTY.PROCESSREFERENCE.PROCESS.EMPTY</p>
            </div>
          </div>
        </div>
      </div>
      <div class="modal-footer">
        <button class="btn btn-primary" ng-click="close()" translate>GENERAL.ACTION.CANCEL</button>
        <button class="btn btn-primary" ng-click="open()" ng-disabled="!selectedProcess || state.processError"
                translate>GENERAL.ACTION.OPEN
        </button>
        <button class="btn btn-primary" ng-click="save()" ng-disabled="state.processError" translate>
          GENERAL.ACTION.SAVE
        </button>
      </div>
    </div>
  </div>
</div>
